home *** CD-ROM | disk | FTP | other *** search
/ Programming Sound Cards / Programming Sound Cards.iso / sound_76 / sound.c < prev    next >
C/C++ Source or Header  |  1995-01-01  |  399b  |  33 lines

  1. /* Sounds speaker */
  2.  
  3. #include <wesson.h>
  4.  
  5. void sound(int freq, int duration)
  6. {
  7.     _asm \
  8.     {
  9.     mov   al,   0B6h
  10.     out   43h,  al
  11.     mov   dx,   12h
  12.     mov   ax,   34DEh
  13.     div   freq
  14.     out   42h,  al
  15.     mov   al,   ah
  16.     out   42h,  al
  17.     in    al,   61h
  18.     or    al,   3
  19.     out   61h,  al
  20.     }
  21.  
  22.     delay((clock_t)duration);
  23.  
  24.     _asm \
  25.     {
  26.     in    al,   61h
  27.     xor   al,   3
  28.     out   61h,  al
  29.     }
  30. }
  31.  
  32.  
  33.